import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [{
		path: '/',
		name: 'home',
		// component: HomeView
		//---重定向到登录页面---
		redirect: "/login"
	},
	{
		path: '/about',
		name: 'about',
		// route level code-splitting
		// this generates a separate chunk (about.[hash].js) for this route
		// which is lazy-loaded when the route is visited.

		//----使用动态import，只有当使用这个组件时才会加载这个组件
		component: () => import( /* webpackChunkName: "about" */ '../views/AboutView.vue')
	},
	//注册登录与admin页面--start
	{
		path: '/login',
		name: 'login',
		component: () => import('../views/LoginView.vue')
	},
	{
		path: '/admin',
		name: 'admin',
		component: () => import('../views/admin/AdminView.vue')
	}
	//注册登录与admin页面--end
	
]

const router = new VueRouter({
	routes
})

export default router
